
<?
$loai=$_GET[loai];
if($loai==""){$loai=0;}

$id=$_GET[id];
$count=$_POST[count];
if ($id==""){
	for ($i = 1; $i <= $count; $i++) 
	{
	$id= $_POST[industry.$i];
	if($id!=""){break;}
	}
}
if ($id!="")
{
$qr1=mysql_query("select * from tbtintuc where tintuc_id='$id'"); 
$rowedit=mysql_fetch_array($qr1);
$loaitin_id=$rowedit['loaitin_id'];
$tintuc_tieude=$rowedit['tintuc_tieude'];
$tintuc_tomtat=$rowedit['tintuc_tomtat'];
$tintuc_noidung=$rowedit['tintuc_noidung'];
$tintuc_title=$rowedit['tintuc_title'];
$tintuc_keyword=$rowedit['tintuc_keyword'];
$tintuc_des=$rowedit['tintuc_des'];
$tintuc_hinhanh=$rowedit['tintuc_hinhanh'];
$tintuc_vitri=$rowedit['tintuc_vitri'];
$tintuc_thutu=$rowedit['tintuc_thutu'];
$tintuc_date=$rowedit['tintuc_ngay'];
$tintuc_trangthai=$rowedit['tintuc_trangthai'];
$tintuc_phanloai=$rowedit['tintuc_phanloai'];
?>
<script language="javascript">
function validate_form(thisform)
{
with (thisform)
{
	
	if (validate_required(txtten,"Bạn chưa nhập tên!")==false)
 	{txtten.focus();return false;}
	if (validate_required(parent,"Bạn chưa chọn <?=$titloaitin?>!")==false)
 	{parent.focus();return false;}
   
	
}
}
</script>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td style="padding:10px">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
  
  <tr>
    <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td   width="6" height="6"><img src="images/j_crn_tl_med.png" width="6" height="6" /></td>
            <td  background="images/j_crn_t_med.png" width="100%"></td>
            <td  width="6" height="6" ><img src="images/j_crn_tr_med.png" width="6" height="6" /></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="1" background="images/dot.png"></td>
            <td class="bg_title"><table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="5%"><img src="images/icon-48-menumgr.png" width="48" height="48" /></td>
                <td width="45%" class="mana_title"> Sửa <?=$titaddphanloai?></td>
                <td width="50%" align="center">
                  <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td width="75%">&nbsp;</td>
                      <td class="icon_style"><a href="#" onclick="document.getElementById('submit').click()"><img src="images/icon-32-save.png" width="32" height="33"  border="0"/><br />
                      Cập nhật</a></td>
                      <td class="icon_style"><a href="#"><img src="images/icon-32-help.png" width="32" height="32"  border="0"/><br />
                      Tr&#7907; gi&uacute;p</a></td>
                    </tr>
                  </table>
                  </td>
              </tr>
            </table></td>
            <td width="1" background="images/dot.png"></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="6" height="6" ><img src="images/j_crn_bl_med.png" width="6" height="6" /></td>
            <td  background="images/j_crn_b_med.png" width="100%"></td>
            <td width="6" height="6" ><img src="images/j_crn_br_med.png" width="6" height="6" /></td>
          </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td height="7"></td>
  </tr>
  <tr>
    <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td   width="6" height="6"><img src="images/j_crn_tl_med.png" width="6" height="6" /></td>
            <td  background="images/j_crn_t_med.png" width="100%"></td>
            <td  width="6" height="6" ><img src="images/j_crn_tr_med.png" width="6" height="6" /></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="1" background="images/dot.png"></td>
            <td bgcolor="#fbfbfb">
            <form id="frmdanhsach" name="frmdanhsach" method="post" action="index.php?progid=6&baiviet=xuly&loai=<?=$loai?>" onsubmit="return validate_form(this);">
            <input type="hidden" id="id" name="id" value="<?=$id?>" />
              <table width="100%" border="0" cellspacing="2" cellpadding="2">
                <tr>
                  <td valign="top" style="padding-left:15px; width:64%"><fieldset id="fieldsearch2" runat="server">
                  <legend style="font-size:14px; color: black" title="Search" class="title_field"><span class="title_field">Chi tiết <?=$titaddphanloai?></span></legend>
                  <table width="100%" border="0" cellspacing="3" cellpadding="3">
                      <tr>
                        <td align="right" width="25%" class="bg_form_left">Tên </td>
                        <td class="bg_form_right"> <input name="txtten" type="text" id="txtten" maxlength="150" style="width:250px" value="<?=$tintuc_tieude?>"  />                        </td>
                      </tr>
                     
                      <? if($loai==2){?>
                      
                      <tr>
                        <td align="right" class="bg_form_left">Loại tin</td>
                        <td class="bg_form_right"><?php 
						$strsql="select * from tbloaitin where phanloai_id='$loai'  and lang_id='$lang' and loaitin_parent=0 and loaitin_trangthai=1 order by loaitin_id desc";
			 $strAction="";
			$name='parent';?>
                          <select size="1" name=<?php echo $name?>  onchange= <?php echo $strAction?>  >
                            <?php 
			 $qr1=mysql_query($strsql);
			   ?>
                            
                            <option value="" >Cap cao nhat</option>
                            <?php while($row=mysql_fetch_array($qr1))
			{
			?>
                            <option value="<?php echo $row['loaitin_id']?>" <? if($loaitin_id==$row['loaitin_id']){?> selected="selected"<? }?> ><?php echo $row['loaitin_tieude']?></option>
                            <?php
			$bien=$row['loaitin_id'];
			$bienten=$row['loaitin_tieude'];
            caccaptin($bien,$bienten,$loaitin_id);
			
		 } ?></select>                          </td>
                      </tr>
					   <tr>
					     <td align="right" class="bg_form_left">Tóm tắt <?=$titaddphanloai?></td>
					     <td><textarea name="txttomtat" id="txttomtat"  style="width:400px; height:100px"><?=$tintuc_tomtat?></textarea>
                     </td>
					     </tr>						
                          <? }?>
						<tr>
					     <td align="right" class="bg_form_left">Nội dung</td>
					     <td>&nbsp;</td>
					     </tr>
                      <tr>
                        <td colspan="2"  class="bg_form_left">
                          <?php
$oFCKeditor = new FCKeditor('txtnoidung') ;
$oFCKeditor->BasePath	= "../fckeditor/" ;
$oFCKeditor->Value		= $tintuc_noidung ;
$oFCKeditor->Create() ;
echo $sBasePath;
?>                            </td>
                        </tr>
                      <tr>
                        <td align="right" class="bg_form_left">Title</td>
                        <td align="left" ><textarea name="txttitle" cols="50" rows="4" id="txttitle"><?=$tintuc_title?></textarea>
                        </td>
                      </tr>
                      <tr>
                        <td align="right" class="bg_form_left">Keyword</td>
                        <td align="left" ><textarea name="txtkeyword" cols="50" rows="4" id="txtkeyword"><?=$tintuc_keyword?></textarea></td>
                      </tr>
                      <tr>
                        <td align="right" class="bg_form_left">Desciption</td>
                        <td align="left" ><textarea name="txtdesciption" cols="50" rows="4" id="txtdesciption"><?=$tintuc_des?></textarea></td>
                      </tr>
                      
                      <tr>
                        <td align="right" class="bg_form_left"><input type="submit" name="submit" id="submit" value="Cập nhật" /></td>
                        <td align="left" >
                          <input type="reset" name="Reset" id="button" value="Nhập lại" />                        </td>
                      </tr>
                    </table>
                  </fieldset></td>
                  <td></td>
                  <td   valign="top" style="padding-right:15px; width:35%"><fieldset id="fieldsearch" runat="server">
                  <legend style="font-size:14px; color: black" title="Search" class="title_field"><span class="title_field">Thông tin tóm tắt</span></legend>
                  <table width="100%" border="0" cellspacing="1" cellpadding="1">
                  <tr>
                    <td><table width="100%" border="0" cellspacing="1" cellpadding="1">
                      <tr>
                        <td><table width="100%" border="0" cellspacing="2" cellpadding="2">
                          <tr>
                        <td width="28%" align="right" class="bg_form_left">Vị trí </td>
                        <td width="72%" align="left">
                        <select name="slvitri" id="slvitri">
                            <option value="0" <? if($tintuc_vitri==0){?>  selected="selected"<? }?>>Chọn vị trí</option>
                             <option value="1" <? if($tintuc_vitri==1){?>  selected="selected"<? }?>>Nổi bật</option>
                             <option value="2" <? if($tintuc_vitri==2){?>  selected="selected"<? }?>>Video (menu trái)</option>
                            </select>
                        
                        </td>
                      </tr>			
                        
                          <tr>
                            <td align="right" class="bg_form_left">Khóa</td>
                            <td align="left" ><input type="radio" name="txtstatus" id="txtstatus" value="0"  <? if($tintuc_trangthai==0){?> checked="checked"<? }?> />
                              có
                              <input name="txtstatus" type="radio" id="txtstatus" value="1" <? if($tintuc_trangthai==1){?> checked="checked"<? }?> />
                              không</td>
                          </tr>
                          <tr>
                            <td align="right" class="bg_form_left">Thứ tự</td>
                            <td align="left" ><label>
                              <input type="text" name="txtthutu" id="txtthutu" value="<?=$tintuc_thutu?>" />
                              </label></td>
                            </tr>
                          <tr>
                            <td align="right" class="bg_form_left">&nbsp;</td>
                            <td align="left" >&nbsp;</td>
                            </tr>
                          </table></td>
                      </tr>
                      <tr>
                        <td>Ảnh minh họa                          </td>
                      </tr>
                      <tr>
                        <td><input type="text" id="userfile" name="userfile"  value="<?=$tintuc_hinhanh?>"  size="10" />
                          <input type="button" name="button4" id="button3" value="Chọn" onclick="JavaScript:window.open('Select_file.php?Dir=news&amp;form=userfile','_upLoad' ,'height=520,width=650,resizable=no,scrollbars=yes')") />
                          <input type="button" name="button3" value="Up file" onclick="JavaScript:window.open('Upfile.php?Dir=news&amp;form=userfile','_upLoad' ,'height=220,width=450,resizable=no,scrollbars=yes')") />
                          <input type="button" name="Button" value="Xoá" onclick="clsText();" /></td>
                      </tr>
                      
                    </table></td>
                  </tr>
                  </table>
                  </fieldset>
                </td>
                </tr>
                </table>

                  
              
                        </form>
            </td>
            <td width="1" background="images/dot.png"></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="6" height="6" ><img src="images/j_crn_bl_med.png" width="6" height="6" /></td>
            <td  background="images/j_crn_b_med.png" width="100%"></td>
            <td width="6" height="6" ><img src="images/j_crn_br_med.png" width="6" height="6" /></td>
          </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
</table>
</td>
  </tr>
</table>
<? }?>